﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mr="http://mishrareader.codeplex.com/Reader">

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="Item" Margin="0,0,0,4">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Path Grid.Column="0" Name="Arrow" Opacity="0" Margin="0,1,0,0" Width="5" Height="6" Stretch="Fill" Fill="{DynamicResource MetroTabItemColor}" Data="{StaticResource PathTabItemArrow}" />
                        <Border Name="Border" Grid.Column="1" Background="Transparent" TextBlock.FontSize="11" TextBlock.FontWeight="Bold" TextBlock.Foreground="{DynamicResource MetroTabItemColor}" >
                            <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" ContentSource="Header" Margin="4,3,30,3"/>
                        </Border>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="Normal" GeneratedDuration="0:0:0.1"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Item">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.5"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Arrow">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1.0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Arrow">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                        <Trigger Property="IsMouseOver" Value="True" SourceName="Item">
                            <Setter TargetName="ContentSite" Property="Opacity" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="LeftTabControl" TargetType="{x:Type mr:AnimatedTabControl}">
        <Setter Property="TabStripPlacement" Value="Left" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="1" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <mr:AnimatedTabPanel x:Name="PART_AnimatedTabPanel" Grid.Column="0" ZIndex="1" IsItemsHost="true" Margin="0,0,30,0" />
                        <Rectangle Width="1" Fill="{StaticResource MetroLineLight}" Grid.Column="1" Grid.RowSpan="2" />
                        <ScrollViewer VerticalAlignment="Stretch" Grid.Column="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">

                            <Grid Name="PART_Contents" Margin="30,0,0,0"  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <TranslateTransform />
                                    </TransformGroup>
                                </Grid.RenderTransform>

                                <ContentPresenter ContentSource="SelectedContent" Margin="0,0,1,0" />

                            </Grid>
                        </ScrollViewer>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="LeftTabItem" TargetType="{x:Type TabItem}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="Foreground" Value="{StaticResource MetroText}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Opacity" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="Item">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>

                        </Grid.ColumnDefinitions>
                        <Path Grid.Column="0" Name="Arrow" Opacity="0" Margin="0,1,0,0" Width="5" Height="6" Stretch="Fill" Fill="{StaticResource MetroText}" Data="{StaticResource PathTabItemArrow}" />

                        <Border Name="Border" Background="Transparent" Grid.Column="1"  Margin="10,3,30,3" TextElement.FontFamily="{StaticResource SemiBoldFont}" TextBlock.FontSize="{StaticResource NormalTextSize }"  >
                                <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" ContentSource="Header"/>
                            </Border>


                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="Normal" GeneratedDuration="0:0:0.1"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Item">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.5"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Arrow">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1.0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Arrow">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                       
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Item" Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelected" Value="False" />
                                <Condition Property="Selector.IsMouseOver" Value="True" SourceName="Item"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentSite" Property="Opacity" Value="0.6"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>